From: Ian Campbell Date: Wed, 4 Dec 2013 17:48:56 +0000 (+0000) Subject: tools: libxl: testidl: initialise the KeyedUnion keyvar before the union X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5815 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=fba6c4ba5e8563d7ce53750750ac273781bd9398;p=xen.git tools: libxl: testidl: initialise the KeyedUnion keyvar before the union This is Coverity CID 1135378 and 1135379. Signed-off-by: Ian Campbell Cc: Andrew Cooper --- diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py index 6fab4933d5..722b7f4bdc 100644 --- a/tools/libxl/gentest.py +++ b/tools/libxl/gentest.py @@ -42,6 +42,7 @@ def gen_rand_init(ty, v, indent = " ", parent = None): elif isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") + s += gen_rand_init(ty.keyvar.type, parent + ty.keyvar.name, indent, parent) s += "switch (%s) {\n" % (parent + ty.keyvar.name) for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None)